﻿using AutoMapper;
using B.MES.FLH.WarehouseManagement.Application;
using B.MES.FLH.WarehouseManagement.Application.Dtos.Area;
using B.MES.FLH.WarehouseManagement.Domain.Entity;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Standard;
using Yitter.IdGenerator;

namespace B.MES.FLH.WarehouseManagement.Controllers
{
    /// <summary>
    /// 库区控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class AreaController : ControllerBase
    {
        private readonly IService _service;

        public AreaController(IService service)
        {
            _service = service;
        }
        /// <summary>
        /// 库区新增
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("CreateAREAMODEL")]
        public ApiResult<int> CreateAREAMODEL(CreateAreaModelInput input)
        {
            return _service.CreateAREAMODEL(input);
        }
        /// <summary>
        /// 库区修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost("UpdateAREAMODEL")]
        public ApiResult<int> UpdateAREAMODEL(UpdateAreaModelInput input)
        {
            return _service.UpdateAREAMODEL(input);
        }
        /// <summary>
        /// 库区删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpPost("DeleteAREAMODEL")]
        public ApiResult<int> DeleteAREAMODEL(string id)
        {
            return _service.DeleteAREAMODEL(id);
        }
        /// <summary>
        /// 库区查询
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        [HttpGet("GetAREAMODEL")]
        public ApiPaging<AreaModelOutput> GetAREAMODEL([FromQuery]PageArea page)
        {
            return _service.GetAREAMODEL(page);
        }
        /// <summary>
        /// 库区详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet("GetAREADESC")]
        public ApiResult<AreaDescOutput> GetAREADESC(string id)
        {
            return _service.GetAREADESC(id);
        }
        /// <summary>
        /// 获取库区下拉框
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetWarehouseAreaIdAndName")]
        public ApiResult<List<GetWarehouseAreaIdAndName>> GetWarehouseAreaIdAndName()
        {
            return _service.GetWarehouseAreaIdAndName();
        }
    }
}
